// var app = require('express')();
var bodyParser = require('body-parser');
var multer = require('multer'); // v1.0.5
var upload = multer(); // for parsing multipart/form-data

const before = function (app, server) {

  app.use(bodyParser.json()); // for parsing application/json
  app.use(bodyParser.urlencoded({ extended: true })); // for parsing application/x-www-form-urlencoded

  app.get('/test', function(req, res) {
    res.json({ custom: 'response' });
  });

  app.post('/profile', upload.array(), function (req, res, next) {
    console.log(req.body);
    res.json(req.body);
  });

}

module.exports = {
  before: before
}
